package Practices;

import java.util.Random;

public class disturb {
    public static void main(String[] args) {
        //@@打乱字符
        //1.
        String str = "abcdefg";
        //2.
        char[] arrCa = str.toCharArray();//[ , , ,]
        //3.
        Random random = new Random();
        int index;
        for (int i = 0; i < arrCa.length; i++) {
            index = random.nextInt(arrCa.length);
            char temp = arrCa[i];
            arrCa[i] = arrCa[index];
            arrCa[index] = temp;
        }
        String result = new String(arrCa);
        System.out.println(result);
    }
}
